/*
 * SimTabs.java
 *
 * Created on June 1, 2008, 10:56 PM
 */

package p2p.simulator.gui;

import java.util.Vector;
import javax.swing.JMenuItem;
import p2p.simulator.Simulator;

/**
 *
 * @author  papalukg
 */
public class SimTabs extends javax.swing.JPanel {
    
    private Simulator S;
    private SimGui G;
    private StatusBar statBar;
    
    /** Creates new form SimTabs */
    public SimTabs(Simulator S, StatusBar statBar, SimGui G) {
        this.statBar = statBar;
        this.S = S;
        this.G = G;
        initComponents();
        jTabbedPane1.remove(1);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        setUp1 = new p2p.simulator.gui.SetUp(S, statBar, G);
        operations1 = new p2p.simulator.gui.Operations(S, statBar);
        experiments1 = new p2p.simulator.gui.Experiments(S, statBar);
        statistics1 = new p2p.simulator.gui.Statistics(S, statBar);

        jTabbedPane1.setFont(new java.awt.Font("Dialog", 0, 12));
        jTabbedPane1.addTab("SetUp", setUp1);
        jTabbedPane1.addTab("Operations", operations1);
        jTabbedPane1.addTab("Experiments", experiments1);

        statistics1.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                statistics1ComponentShown(evt);
            }
        });
        jTabbedPane1.addTab("Statistics", statistics1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void statistics1ComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_statistics1ComponentShown
        // TODO add your handling code here:
        statistics1.updateStatistics();
    }//GEN-LAST:event_statistics1ComponentShown
    
    public void setEnabled(boolean f) {
                
        jTabbedPane1.setEnabledAt(1, f);
        jTabbedPane1.setEnabledAt(2, f);
        //jTabbedPane1.setEnabledAt(3, f);
    }
    
    public p2p.simulator.gui.SetUp getSetUpTab () {
        return setUp1;
    } 
    
    public p2p.simulator.gui.Operations getOperationsTab() {
        return operations1;
    }
    
    public p2p.simulator.gui.Experiments getExperimentsTab() {
        return experiments1;
    }
    
    public p2p.simulator.gui.Statistics getStatistics () {
        return statistics1;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private p2p.simulator.gui.Experiments experiments1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private p2p.simulator.gui.Operations operations1;
    private p2p.simulator.gui.SetUp setUp1;
    private p2p.simulator.gui.Statistics statistics1;
    // End of variables declaration//GEN-END:variables
    
}
